package day05;

import java.util.Scanner;

public class ForDemo1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int answer,num1,num2,score=0;
        for (int i = 0; i <10 ; i++) {
            num1 = (int)(Math.random()*100+1);
            num2 = (int)(Math.random()*100+1);
            System.out.print(num1+"+"+num2+"=");
            answer = sc.nextInt();
            if (answer == -1){
                System.out.println("退出系统成功");
                break;
            }
            if (answer == num1+num2){
                System.out.println("恭喜你，回答正确");
                score +=10;
            }else {
                System.out.println("回答错误");
            }
        }
        System.out.println("你的得分为："+score);
    }
}
